#ifndef __server
#define __server

#include <string>
#include <queue>

struct qdata {
  int connection;
  std::string cmd;
  qdata (int _c, const std::string& _cmd) : connection (_c), cmd (_cmd) {}
};

struct cmdq { // command queue

  enum {free, busy}; // states
  int state; // state
  std::queue<qdata> q;
  void push (int conn, const std::string& cmd);
  void pop ();
  cmdq () { state = free; }

};

struct server : cmdq {
  virtual void start () = 0;
  virtual void stop () = 0;
};

void send_all (int connection, const std::string& str);

#endif
